1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34//
// ContentView.swift
// Trieste Watch App
//
// Created by Jake Teton-Landis on 10/14/22.
//
import SwiftUI
import CoreMotion
struct ContentView: View {
var body: some View {
if (!CMWaterSubmersionManager.waterSubmersionAvailable) {
CannotDiveView(text: "Depth not available on this device")
} else {
switch(CMWaterSubmersionManager.authorizationStatus) {
case .notDetermined: DiveView()
case .authorized: DiveView()
case .denied: CannotDiveView(text: "You don't allow access to depth")
case .restricted: CannotDiveView(text: "Access to depth restricted by system")
@unknown default: DiveView()
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
.previewDevice("Apple Watch Ultra (49mm)")
}
}